package o;

import android.util.Log;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import o.lf.e;

class jz extends lc {
    private static final e ˏ = new e() {
        @NonNull
        public <T extends lc> T ˏ(@NonNull Class<T> cls) {
            return new jz(true);
        }
    };
    private boolean ʻ = false;
    private boolean ʽ = false;
    private final HashMap<String, jz> ˊ = new HashMap();
    private final HashMap<String, lh> ˋ = new HashMap();
    private final boolean ˎ;
    private final HashSet<Fragment> ॱ = new HashSet();

    @NonNull
    static jz ˎ(lh lhVar) {
        return (jz) new lf(lhVar, ˏ).ˋ(jz.class);
    }

    jz(boolean z) {
        this.ˎ = z;
    }

    protected void ˏ() {
        if (kd.ˎ) {
            Log.d("FragmentManager", "onCleared called for " + this);
        }
        this.ʽ = true;
    }

    boolean ˊ() {
        return this.ʽ;
    }

    boolean ˏ(@NonNull Fragment fragment) {
        return this.ॱ.add(fragment);
    }

    @NonNull
    Collection<Fragment> ˋ() {
        return this.ॱ;
    }

    boolean ॱ(@NonNull Fragment fragment) {
        if (!this.ॱ.contains(fragment)) {
            return true;
        }
        if (this.ˎ) {
            return this.ʽ;
        }
        if (this.ʻ) {
            return false;
        }
        return true;
    }

    boolean ˋ(@NonNull Fragment fragment) {
        return this.ॱ.remove(fragment);
    }

    @NonNull
    jz ˊ(@NonNull Fragment fragment) {
        jz jzVar = (jz) this.ˊ.get(fragment.ˊॱ);
        if (jzVar != null) {
            return jzVar;
        }
        jzVar = new jz(this.ˎ);
        this.ˊ.put(fragment.ˊॱ, jzVar);
        return jzVar;
    }

    @NonNull
    lh ˎ(@NonNull Fragment fragment) {
        lh lhVar = (lh) this.ˋ.get(fragment.ˊॱ);
        if (lhVar != null) {
            return lhVar;
        }
        lhVar = new lh();
        this.ˋ.put(fragment.ˊॱ, lhVar);
        return lhVar;
    }

    void ॱॱ(@NonNull Fragment fragment) {
        if (kd.ˎ) {
            Log.d("FragmentManager", "Clearing non-config state for " + fragment);
        }
        jz jzVar = (jz) this.ˊ.get(fragment.ˊॱ);
        if (jzVar != null) {
            jzVar.ˏ();
            this.ˊ.remove(fragment.ˊॱ);
        }
        lh lhVar = (lh) this.ˋ.get(fragment.ˊॱ);
        if (lhVar != null) {
            lhVar.ˏ();
            this.ˋ.remove(fragment.ˊॱ);
        }
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        jz jzVar = (jz) obj;
        if (this.ॱ.equals(jzVar.ॱ) && this.ˊ.equals(jzVar.ˊ) && this.ˋ.equals(jzVar.ˋ)) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        return (((this.ॱ.hashCode() * 31) + this.ˊ.hashCode()) * 31) + this.ˋ.hashCode();
    }

    @NonNull
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder("FragmentManagerViewModel{");
        stringBuilder.append(Integer.toHexString(System.identityHashCode(this)));
        stringBuilder.append("} Fragments (");
        Iterator it = this.ॱ.iterator();
        while (it.hasNext()) {
            stringBuilder.append(it.next());
            if (it.hasNext()) {
                stringBuilder.append(", ");
            }
        }
        stringBuilder.append(") Child Non Config (");
        Iterator it2 = this.ˊ.keySet().iterator();
        while (it2.hasNext()) {
            stringBuilder.append((String) it2.next());
            if (it2.hasNext()) {
                stringBuilder.append(", ");
            }
        }
        stringBuilder.append(") ViewModelStores (");
        it2 = this.ˋ.keySet().iterator();
        while (it2.hasNext()) {
            stringBuilder.append((String) it2.next());
            if (it2.hasNext()) {
                stringBuilder.append(", ");
            }
        }
        stringBuilder.append(')');
        return stringBuilder.toString();
    }
}
